home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
019
/
ratio16a.arc
/
RSB3-RAT.MRG
< prev
Wrap
Text File
|
1988-04-12
|
19KB
|
331 lines
* ------------[ BLED merge (c) Ken Goosens ]-------------
* Merge this against RSB3-CLR.MRG to produce RSB3MODS.MRG
* RSB3-CLR.MRG: Date 4-12-1988 Size 27306 bytes
* ------------[ Created 04-12-1988 20:09:51 ]------------
* REPLACING old line(s) by new
* ------------[ BLED merge (c) Ken Goosens ]-------------
* Merge this against TEST\RBBSSUB3.BAS to produce RBBSSUB3.BAS
* TEST\RBBSSUB3.BAS: Date 3-25-1988 Size 183747 bytes
* ------------[ Created 04-12-1988 19:44:01 ]------------
* REPLACING old line(s) by new
* ------[ first line different ]------
' $linesize:132
' $title: 'RBBSSUB3.BAS CPC16-1A, Copyright 1986 - 88 by D. Thomas Mack'
' Copyright 1987 by D. Thomas Mack, all rights reserved.
' Name ...............: RBBSSUB3.BAS
' Written by .........: D. Thomas Mack
' First Released .....: June 29, 1986
' Subsequent Releases.: September 28, 1986, March 15, 1987, June 7, 1987
' : November 15, 1987, March 27, 1988
' Copyright ..........: 1986, 1987, 1988
' Purpose.............: The Remote Bulletin Board System for the IBM PC,
' RBBS-PC.BAS utilizes a lot of common subroutines.
' Those that do not require error trapping are
' incorporated within RBBSSUB2.BAS and RBBSSUB3.BAS
' as separately callable subroutines in order to free
' up as much code as possible within the 64K code
' segment used by RBBS-PC.BAS.
' Parameters..........: Most parameters are passed via a COMMON statement.
'
' Subroutine Line Function of Subroutine
' Name Number
' ALLCAPS 58060 Convert a string to all upper case characters
' AMORPM 41500 Calculate the current time as AM or PM
' ANYBUT 59760 Determine where a "word" begins
' ASKMORE 59700 Check whether screen full
' ASKUSERS 64005 Ask users questions based on a script and save answers
' BUFFILE 58400 Write a file to the user quickly
' BUFSTRNG 58300 Write a string with imbedded CR/LF to the user quickly
' CALLOPT 58090 Set prompts based on the user's security
' CARRIER 42000 Test for Carrier present
' CHECKTIM 58070 Test to insure that users don't exceed their time
' CHKNARY 58180 Check for the occurance of a string in an array
' CHKNEWBUL 58110 Check for new bulletins based on their file creation date
' CHKTREMAIN 41008 Set up to log off if time exceeded
' COMMINFO 44000+ Get users baud rate and parity in a string format
' COMPDATE 59200+ Produces a computational data from YY, MM, DD
' CONVDIRS 58950 Checks for U & A (shorthand) and converts appropriately
' CTLINES 58160 Count categories a file can be classified into
' CTNEWFILES 58150 Check for number of files uploaded after a specific date
' DELAYIT 50500 Wait number of seconds specified before returning
' DISPCALL 57001 Display callers file
' DISPLAYTR 41010+ Compute and display time remaining
' DISUPDIR 58170 Display the shared directory of the FMS mng. sys.
' EXPDATE 52000+ Calculate registration expiration date
' FAKEXRPT 62650 Write out file transfer report for protocols that don't
' FILELOCK 21995 Allow files to be shared among multiple RBBS-PC's
' FINDEND 58770 Find where a "word" ends
' FINDFILE 58790 Determine whether a file exists without opening it
' FINDFUNC 30600 Handle local keyboard's function & SYSOP's keys
' FINDLAST 58600 Finds last occurence of a string in a string
' FINDTIME 58050 Calculate the number of seconds since midnight
' FMS 58200 Search the upload management system for entries
' GETALL 59780 Get list of all directories to display
' GETDIRS 58900 Prompts for directories for file list/new/search cmds
' GETMATTR 62530 Restore attributes of original message
' GETYMD 59200 Pulls YY, MM, or DD from a 2 byte stored date
' GRAPHIC 43031 Determines whether graphic version of file exists
' HASHRBBS 58080 "Hash" to a user's record in the USERS file
' INITFMS 58160+ Initialize the RBBS-PC's File Management System
' INITIBM 30000 Open/create NETBIOS semaphore file
' INSCOMMA 58130 Format commands in the command prompt
' LOADNEW 58140 Find the latest uploads
' LOGDOWN 59400 Records download in private directory
' MIMPORT 59700 Allow local user to import a text file to a message
' MODEMPUT 52070 Write a modem command string to the modem
' MUZAK 59100 Play musical themes for different RBBS functions
' OPENMSG 30500 Open the messages file as file number 1
' PAGEUP 33202 Display user info. on local screen for SYSOP
' PERSFILE 59300 View and select personal files for downloading
' PROTOCOL 62600 Determine if external protocols are available
' PUTMATTR 62520 Save attributes of original message
' READPROF 44000 Read user's profile on return from a "door"
' REMOVE 58210 Remove characters from within strings
' ROTORSDIR 58700 Searches for a file using list of subdirs
' SAVEPROF 43070 Save the user's provile when exiting to "doors" or DOS
' SETABORT 58750 Set time for a process to abort
' SETECHO 59600 Set RBBS properly for who is to echo
' SETOPTS 58100 Set correct prompt line for each subsystem
' SRTSTRNG 58120 Sort characters in a string
' SUBMENU 59500 Processes options that have sub-menus
' TIMEDOUT 63000 Write timed exit .BAT file to RCTTY.BAT
' TIMEREMAIN 41010 Compute time remaining in minutes
' TRANSFER 62620 RBBS-PC support for external protocols for file transfer
' TWOBYTEDATE 59200 Reduces a data to 2 byte string for space compression
' USERFACE 59450 Processes programmable user interface
' VIEWARC 64600 Display .ARC file contents to user
' WIPELINE 58800 Wipes away a line so next prints in its place
' WORDWRAP 59700+ Adjust a message --wrap linesand perserve paragraphs
' XFRETURN 62629 Private door exit routine
'
' $INCLUDE: 'RBBS-VAR.BAS'
'
* ------[ first line different ]------
'
' $SUBTITLE: 'CHECKRATIO - subroutine to print ul/dl ratio'
' $PAGE
'
' SUBROUTINE NAME -- CHECKRATIO
'
' INPUT PARAMETERS -- PARAMETER MEANING
' TELL.USER TELL USER ABOUT THEIR RATIO
' DOWNLOADS FILES DOWNLOADED
' DLBYTES! BYTES DOWNLOADED
' UPLOADS FILES UPLOADED
' ULBYTES! BYTES UPLOADED
'
' OUTPUT PARAMETERS -- OK - IF IT IS OK FOR THE USER TO DOWNLOAD
'
' SUBROUTINE PURPOSE -- TO PRINT THE USERS UPLOAD TO DOWNLOAD RATIO
' AND TO DETERMINE IF THE USERS HAS VIOLATED
' THEIR UPLOAD TO DOWNLOAD RESTRICTION
'
'
SUB CHECKRATIO (TELL.USER) STATIC 'RATIO
OK = TRUE 'RATIO
'
' PRINT THE CALLERS UPLOAD AND DOWNLOAD STATISTICS
'
* INSERTING new line(s)
* INSERTING new line(s)
20096 CHANGE.COLOR = FALSE 'COLOR
A$ = "You uploaded" + STR$(UPLOADS) + " file(s) containing" + _ 'RATIO
STR$(ULBYTES!) + " bytes" 'RATIO
SUBROUTINE.PARAMETER = 1 'RATIO
CALL TPUT 'RATIO
A$ = "You downloaded" + STR$(DOWNLOADS) + " file(s) containing"+_ 'RATIO
STR$(DLBYTES!) + " bytes" 'RATIO
SUBROUTINE.PARAMETER = 5 'RATIO
CALL TPUT 'RATIO
A$ = "Today you downloaded" + STR$(DL.TODAY!) + " file(s)" + _ 'RATIO
" containing" + STR$(BYTES.TODAY!) + " bytes" 'RATIO
SUBROUTINE.PARAMETER = 5 'RATIO
CALL TPUT 'RATIO
CALL SKIPLINE (1) 'RATIO
CHANGE.COLOR = TRUE 'COLOR
A$ = "Your average upload to download ratio is:" 'RATIO
SUBROUTINE.PARAMETER = 5 'RATIO
CALL TPUT 'RATIO
'
' DETERMINE METHOD OF RATIO CHECKING TO BE PERFORMED
'
20097 IF BYTE.METHOD = 1 THEN 'RATIO
METHOD$ = "byte(s)" 'RATIO
UL.WORK# = ULBYTES! 'RATIO
DL.WORK# = DLBYTES! 'RATIO
ELSEIF BYTE.METHOD = 0 THEN 'RATIO
METHOD$ = "file(s)" 'RATIO
UL.WORK# = UPLOADS 'RATIO
DL.WORK# = DOWNLOADS 'RATIO
ELSEIF BYTE.METHOD = 2 THEN 'RATIO
METHOD$ = " files" 'RATIO
UL.WORK# = UPLOADS 'RATIO
DL.WORK# = DOWNLOADS 'RATIO
TODAY# = RATIO.RESTRICTON# - DL.TODAY! 'RATIO
ELSEIF BYTE.METHOD = 3 THEN 'RATIO
METHOD$ = " bytes" 'RATIO
UL.WORK# = ULBYTES! 'RATIO
DL.WORK# = DLBYTES! 'RATIO
TODAY# = RATIO.RESTRICTON# - BYTES.TODAY! - NUM.DNLD.BYTS! 'RATIO
END IF 'RATIO
'
' PRINT THE USERS UPLOAD TO DOWNLOAD RATIO
'
20098 IF UL.WORK# <> 0 AND DL.WORK# <> 0 THEN 'RATIO
IF UL.WORK# > DL.WORK# THEN 'RATIO
UL.RATIO# = INT((((UL.WORK# / DL.WORK#)+.5)*10)/10) 'RATIO
DL.RATIO# = 1 'RATIO
XFER.RATIO# = 0 'RATIO
ELSE 'RATIO
UL.RATIO# =1 'RATIO
DL.RATIO# = DL.WORK# / UL.WORK# 'RATIO
XFER.RATIO# = DL.RATIO# 'RATIO
END IF 'RATIO
DL.RATIO# = INT(((DL.RATIO#+.5)*10)/10) 'RATIO
ELSE 'RATIO
DL.RATIO# = DL.WORK# 'RATIO
UL.RATIO# = UL.WORK# 'RATIO
IF UL.WORK# = 0 THEN 'RATIO
XFER.RATIO# = RATIO.RESTRICTON# 'RATIO
ELSE 'RATIO
XFER.RATIO# = DL.RATIO# 'RATIO
END IF 'RATIO
END IF 'RATIO
20099 A$ = STR$(UL.RATIO#) + " " + METHOD$ + " uploaded for every" + _ 'RATIO
STR$(DL.RATIO#) + " " + METHOD$ + " downloaded" 'RATIO
SUBROUTINE.PARAMETER = 5 'RATIO
CALL TPUT 'RATIO
CALL SKIPLINE (1) 'RATIO
'
' CHECK TO SEE IF THE USERS HAS VIOLATED THEIR UL/DL RESTRICTION
'
20100 IF RATIO.RESTRICTON# AND TELL.USER THEN 'RATIO
IF BYTE.METHOD > 1 THEN 'RATIO
IF TODAY# <= 0 THEN 'RATIO
A$ = "You have reached you limit of" + _ 'RATIO
STR$(RATIO.RESTRICTON#) + METHOD$ + " per day. "+_ 'RATIO
"Try again tomorrow." + _ 'RATIO
CHR$(7) 'RATIO
OK = FALSE 'RATIO
ELSE 'RATIO
A$ = "You can download" + STR$(TODAY#) + _ 'RATIO
" more" + METHOD$ + " for today." 'RATIO
OK = TRUE 'RATIO
END IF 'RATIO
SUBROUTINE.PARAMETER = 5 'RATIO
CALL TPUT 'RATIO
CALL SKIPLINE(1) 'RATIO
EXIT SUB 'RATIO
END IF 'RATIO
END IF 'RATIO
'
'
'
IF RATIO.RESTRICTON# AND TELL.USER THEN 'RATIO
IF XFER.RATIO# => RATIO.RESTRICTON# THEN 'RATIO
OK = FALSE 'RATIO
CHANGE.COLOR = FALSE 'COLOR
A$ = "Your upload to download ratio is too low to download!"'RATIO
SUBROUTINE.PARAMETER = 5 'RATIO
CALL TPUT 'RATIO
A$ = "You must upload at least" + _ 'RATIO
STR$(INT(((DL.WORK# - (UL.WORK# * RATIO.RESTRICTON#)) _'RATIO
/ RATIO.RESTRICTON#) + 1)) + _ 'RATIO
+ " " + METHOD$ + " before you can download!" + CHR$(7)'RATIO
ELSE 'RATIO
A$ = "You can download" + _ 'RATIO
STR$(INT((UL.WORK# * RATIO.RESTRICTON#)-DL.WORK#)) + _ 'RATIO
" " + METHOD$ + " before you need to upload" 'RATIO
END IF 'RATIO
SUBROUTINE.PARAMETER = 5 'RATIO
CALL TPUT 'RATIO
CALL SKIPLINE (1) 'RATIO
END IF 'RATIO
20101 CHANGE.COLOR = TRUE 'COLOR
END SUB 'RATIO
'
'
' $SUBTITLE: 'FILELOCK - subroutine to share RBBS-PC files'
' $PAGE
'
' SUBROUTINE NAME -- FILELOCK
'
' INPUT PARAMETERS -- PARAMETER MEANING
' SUBROUTINE.PARAMETER = 1 UNLOCK USERS AND MESSAGES
' 2 FLUSH MESSAGE RECORD TO DISK
' AND UNLOCK MESSAGES
' 3 LOCK MESSAGE FILE
' 4 UNLOCK MESSAGE FILE
' 5 LOCK USER FILE
' 6 LOCK 4 RECORD BLOCK IN USER
' FILE
' 7 UNLOCK USER FILE
' 8 UNLOCK 4 RECORD BLOCK IN USER
' FILE
' 9 LOCK UPLOAD DIRECTORY OR
' COMMENTS FILE
' 10 UNLOCK UPLOAD DIRECTORY OR
' COMMENTS FILE
' ACTIVE.MESSAGE FILE$ NAME OF MESSAGE FILE
' ACTIVE.USER.FILE$ NAME OF USER FILE
' CONFIG.FILE.NAME$ FILE NAME TO FLUSH RECORD FROM
' EN$ UPLOAD DIRECTORY OR COMMENTS
' FILE NAME TO LOCK/UNLOCK
' NETWORK.TYPE TYPE OF NETWORK LOCKING TO USE
'
' OUTPUT PARAMETERS -- SUBROUTINE.PARAMETER = -1 TERMINATE RBBS-PC IMMEDATELY
' BLK
' LOCK.DRIVE
' LOCK.FILE.NAME$
' LOCK.STATUS$
' MESSAGE.FILE.LOCK
' USER.BLOCK.LOCK
' USER.FILE.LOCK
' USER.FILE.INDEX
'
' SUBROUTINE PURPOSE -- TO LOCK AND UNLOCK THE SHARED RBBS-PC FILES WHEN
' MULTIPLE COPIES OF RBBS-PC ARE SHARING THE SAME
' FILES IN EITHER A MULTI-TASKING DOS ENVIRONMENT OR
' IN A LOCAL AREA NETWORK ENVIRONMENT
SUB FILELOCK STATIC
ON SUBROUTINE.PARAMETER GOSUB 21995,21996,22000,25000,26000, _
26500,27000,27500,29000,29500
EXIT SUB
'
' *****************************************************************************
' * UNLOCK USERS AND MESSAGES *
' *****************************************************************************
'
* REPLACING old line(s) by new
33990 SUB PAGEUP STATIC
CALL LPRNT (" ",1)
CALL LPRNT ("USER NAME : " + ACTIVE.USER.NAME$,1)
CALL LPRNT ("SECURITY :" + STR$(USER.SECURITY.SAVE),1)
CALL LPRNT ("PASSWORD :" + PASSWORD.SAVE$,1)
CALL LPRNT ("READ MSG. :" + STR$(LAST.MESSAGE.READ),1)
CALL LPRNT ("TIMES ON :" + STR$(TIMES.LOGGED.ON),1)
CALL LPRNT ("LAST ON :" + LAST.DATE.TIME.ON.SAVE$,1)
CALL LPRNT ("DOWNLOADS :" + STR$(DOWNLOADS),1)
CALL LPRNT ("UPLOADS :" + STR$(UPLOADS),1)
* ------[ first line different ]------
CALL LPRNT ("DL-BYTES :" + STR$(DLBYTES!),1) 'RATIO
CALL LPRNT ("UL-BYTES :" + STR$(ULBYTES!),1) 'RATIO
IF RESTRICT.BY.DATE THEN _
CALL LPRNT ("EXPIRATION: " + EXPIRATION.DATE$,1)
CALL LPRNT ("User's Profile",1)
END SUB
' $SUBTITLE: 'CHKTREMAIN - Kicks off if no time remaining'
' $PAGE
'
' SUBROUTINE NAME -- CHKTREMAIN
'
' INPUT PARAMETERS -- PARAMETER MEANING
' TIME.LEFT!
' OUTPUT PARAMETERS -- PARAMETER MEANING
' TIME.LEFT! TIME IN MINUTES LEFT IN SESSION
' TCA! TIME USED IN SECONDS
' SUBROUTINE.PARAMETER -1 if no time left
SUB CHKTREMAIN (TIME.LEFT!) STATIC
* REPLACING old line(s) by new